import request from '@/utils/request'

export const findMenuAndPermissionAll = () => {
  return request({
    url:'/menu/findMenuAndPermissionAll',
    method:'get',
  }).then(res => {
    return res
  },error => {
    return error
  })
}

export const findPermissionsByName = (permissionName) => {
  return request({
    url:'/menu/findPermissionsByName',
    method:'get',
    params:{
      permissionName
    }
  }).then(res => {
    return res
  },error => {
    return error
  })
}

export const findMenusByPage = (current,size,menuVO) => {
  return request({
    url:'/menu/findMenusByPage',
    method:'post',
    params:{
      current,
      size
    },
    data:menuVO
  }).then(res => {
    return res
  },error => {
    return error
  })
}

export const findParentMenuIdAndName = () => {
  return request({
    url:'/menu/findParentMenuIdAndName',
    method:'get',
  }).then(res => {
    return res
  },error => {
    return error
  })
}

export const findMenusToPa = () => {
  return request({
    url:'/menu/findMenusToPa',
    method:'get',
  }).then(res => {
    return res
  },error => {
    return error
  })
}

export const saveOrUpdateMenu = (menuVO) => {
  return request({
    url:'/menu/saveOrUpdateMenu',
    method:'post',
    data:menuVO
  }).then(res => {
    return res
  },error => {
    return error
  })
}

export const findMenuByMenuId = (menuId) => {
  return request({
    url:'/menu/findMenuByMenuId',
    method:'get',
    params:{
      menuId
    },
  }).then(res => {
    return res
  },error => {
    return error
  })
}

export const deleteMenuByMenuId = (menuId) => {
  return request({
    url:'/menu/deleteMenuByMenuId',
    method:'get',
    params:{
      menuId
    },
  }).then(res => {
    return res
  },error => {
    return error
  })
}
